package com.itheima;

import java.util.Scanner;

public class HomeWork1 {
    private String name;
    private String year;

    public HomeWork1() {
    }

    public HomeWork1(String name, String year) {
        this.name = name;
        this.year = year;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }
}

    //测试类
    class HomeWorkDemo {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入工人姓名:");
            String name = sc.nextLine();
            System.out.println("请输入工人工龄");
            String year = sc.nextLine();
            HomeWork1 w = new HomeWork1(name,year);

            System.out.println("该工人对象的信息如下：");
            System.out.println("姓名：" + w.getName());
            System.out.println("工龄：" + w.getYear());
        }
    }